<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>websocket 测试</title>
		<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
	</head>
	<body>
		<div id="div"></div>
		<script type="text/javascript">
			var url = 'ws://localhost:8084/yjbpoint'+'/notify/1/0';
			try {
				var ws;
				// 判断当前浏览器是否支持WebSocket
				if('WebSocket' in window) {
					ws = new WebSocket(url);
				} else {
					console.log('不支持websocket');
				}
				ws.onopen = function(event) {
					console.log('open',event);
				};
				ws.onmessage = function(event) {
					console.log('message',event);
				};
				ws.onclose = function(event) {
					console.log('close',event);
				};
				ws.onerror = function(event) {
					console.log("WebSocket异常！");
				};
			} catch(ex) {
				console.log(ex.message);
			}
		</script>
	</body>
</html>
